package org.railage.server.dao;

import java.util.List;

import org.railage.server.entities.Trip;

/**
 * DAO for trip entity.
 * 
 * @author Cyril Fertikov
 * 
 */
public interface TripDAO {

	/**
	 * Adds new trip with given parameters.
	 * 
	 * @param routeName
	 *            Name of route.
	 * @param seatsNumber
	 *            Amount of seats.
	 * @param startTimestamp
	 *            Trip start time.
	 * @return Result value:<br>
	 *         0 - added successfully,<br>
	 *         1 - given route does not exist,<br>
	 *         -1 - DB session error.
	 */
	int addTrip(String routeName, int seatsNumber, String startTimestamp);

	/**
	 * Deletes trip.
	 * 
	 * @param tripID
	 *            Trip ID.
	 * @return Result value:<br>
	 *         0 - deleted successfully,<br>
	 *         1 - tickets are sold and trip did not finish,<br>
	 *         -1 - DB session error.
	 */
	int deleteTrip(int tripID);

	/**
	 * Gets all existing trips.
	 * 
	 * @return List of trips.
	 */
	List<Trip> getAllTrips();

	/**
	 * Gets trips passing given route.
	 * 
	 * @param routeName
	 *            Name of route.
	 * @return List of trips.
	 */
	List<Trip> getTripsByRouteName(String routeName);
}
